//
//  CustomTableViewCellTextField.m
//  floodAdvisor
//
//  Created by Long Ho on 2/23/10.
//  Copyright 2010 Lafayette College. All rights reserved.
//

#import "CustomTableViewCellTextField.h"


@implementation CustomTableViewCellTextField

@synthesize textField;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        // Initialization code
		textField = [[UITextField alloc] init];
		[self.contentView addSubview:textField];
		
		[textField setDelegate: self];
    }
    return self;
}


- (void) layoutSubviews {
	[super layoutSubviews];
	CGRect contentRect = self.contentView.bounds;

	textField.frame = CGRectMake(contentRect.origin.x + 10, 
								 contentRect.origin.y + 10, 
								 contentRect.size.width - 20, 
								 contentRect.size.height);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark UITextFieldDelegate

- (BOOL)textFieldShouldReturn:(UITextField *)aTextField {
	
	[aTextField resignFirstResponder];
	
	return YES;
	
}

- (void)dealloc {
    [super dealloc];
}


@end
